package com.game.main;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class Executor {
    private final static ExecutorService threadPool = Executors.newFixedThreadPool(6);

    public static void async(Runnable task) {
        threadPool.execute(task);
    }

    public static void async(Runnable... tasks) {
        for (Runnable t : tasks) {
            threadPool.execute(t);
        }
    }

    public static <T> Future<T> async(Callable<T> task) {
        return threadPool.submit(task);
    }
}
